#!/bin/sh
# 从Oracle导出的整体DDL文件，去除CREATE TABLE部分

src_ddl_file=
dest_ddl_file=

usage="\
Usage:
      $(basename $0) -i src_ddl_file -o dest_ddl_file

Options:
       -i <input ddl file>
  
       -o <output ddl file>

       -h show help
"

while test $# -ne 0; do
  case $1 in
    -i) src_ddl_file=$2;shift;;

    -o) dest_ddl_file=$2;shift;;

    -h) echo "$usage";exit $?;;

    *) echo "$usage";exit $?;;
  esac
  shift
done

if test -z "$src_ddl_file";then
  echo "$usage"
  exit 1
fi

cat $src_ddl_file |awk '/create table/,/;/{next} {print}'|awk '!/prompt/'|awk '!/grant/'|awk '!/comment on/'|awk '/^  is /,/;/ {next} {print}' > $dest_ddl_file

